package models;

import java.util.ArrayList;

public class Item {
	
	private int ID;
	private Player player;
	private Rareness rareness;
	private ItemType itemtype;
	private String itemname;
	private ArrayList<Stat> stats;
	
	public Item(int id, Player player, Rareness rareness, ItemType itemtype, String itemname) {
		this.ID = id;
		this.player = player;
		this.rareness = rareness;
		this.itemtype = itemtype;
		this.itemname = itemname;
		this.stats = new ArrayList<Stat>();
	}

	public int getID() {
		return ID;
	}

	public void setID(int id) {
		ID = id;
	}

	public Player getPlayer() {
		return player;
	}

	public void setPlayer(Player player) {
		this.player = player;
	}

	public Rareness getRareness() {
		return rareness;
	}

	public void setRareness(Rareness rareness) {
		this.rareness = rareness;
	}

	public ItemType getItemtype() {
		return itemtype;
	}

	public void setItemtype(ItemType itemtype) {
		this.itemtype = itemtype;
	}

	public String getItemname() {
		return itemname;
	}

	public void setItemname(String itemname) {
		this.itemname = itemname;
	}

	public ArrayList<Stat> getStats() {
		return stats;
	}
	
	public void addStat(Stat stat) {
		this.stats.add(stat);
	}
	
	public void removeStat(Stat stat) {
		this.stats.remove(stat);
	}
	
	public void removeStat(int i) {
		this.stats.remove(i);
	}
	
	public void removeAllStats() {
		this.stats.clear();
	}
	
	public String toString() {
		String temp = null;
		if(itemname != null)
			temp = itemname + ":\n";
		else
			temp = rareness.toString() + " " + itemtype.toString() + ":\n";
		for(Stat s : stats) {
			temp = temp + "  " + s.toString() + "\n";
		}
		return temp;
	}

}
